package com.design.pattern.builder;

import com.design.pattern.builder.product.AutoMessage;
import com.design.pattern.builder.product.GoodByeMsg;
import com.design.pattern.builder.product.WelcomeMsg;

import java.util.Calendar;

/**
 * Created by Administrator on 2016/5/18.
 */
public class GoodByeMsgBuilder implements IMsgBuilder {
    private String from;
    private String to;
    private String date;
    private String subject;
    @Override
    public AutoMessage build() {
        GoodByeMsg msg = new GoodByeMsg();
        msg.setTo(this.to);
        msg.setFrom(this.from);
        msg.setSubject(this.subject);
        msg.setDate(this.date);
        return msg;
    }

    @Override
    public void setTo(String to) {
        this.to = to;
    }

    @Override
    public void setFrom(String from) {
        this.from = from;
    }

    @Override
    public void setSuject() {
        this.subject = "取消订阅主题";
    }

    @Override
    public void setDate() {
        this.date = Calendar.getInstance().getTime().toString();
    }
}
